//
//  MyTakeOrderDetailGoodStatisticsView.m
//  ReceiptDelivery
//
//  Created by 吕晶 on 2021/1/27.
//  Copyright © 2021 吕晶. All rights reserved.
//

#import "MyTakeOrderDetailGoodStatisticsView.h"

@interface MyTakeOrderDetailGoodStatisticsView ()

@property (nonatomic, strong) UIView *bgView;
@property (nonatomic, strong) UILabel *title1Lab;
@property (nonatomic, strong) UILabel *content1Lab;
@property (nonatomic, strong) UILabel *title2Lab;
@property (nonatomic, strong) UILabel *content2Lab;
@property (nonatomic, strong) UILabel *title3Lab;
@property (nonatomic, strong) UILabel *content3Lab;
@property (nonatomic, strong) UILabel *title4Lab;
@property (nonatomic, strong) UILabel *content4Lab;
@property (nonatomic, strong) UILabel *title5Lab;
@property (nonatomic, strong) UILabel *content5Lab;
@property (nonatomic, strong) UILabel *lineLab;
@property (nonatomic, strong) UIButton *closeBtn;

@end

@implementation MyTakeOrderDetailGoodStatisticsView

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        self.frame = CGRectMake(0, 0, ScreenW, ScreenH);
        self.backgroundColor = HexColorA(0x000000, 0.5);
        UIButton *btn = [[UIButton alloc] initWithFrame:self.frame];
        [btn addTarget:self action:@selector(disMissView) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:btn];
        [self configUI];
    }
    return self;
}

- (void)configUI {
    self.bgView = [[UIView alloc] initWithFrame:CGRectMake(30, (ScreenH - 243) * 0.5, ScreenW - 60, 243)];
    self.bgView.backgroundColor = HexColor(0xffffff);
    self.bgView.layer.cornerRadius = 6;
    [self addSubview:self.bgView];
    
    self.closeBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, self.bgView.nim_height - 52, self.bgView.nim_width, 52)];
    [self.closeBtn setTitle:@"关闭" forState:0];
    [self.closeBtn setTitleColor:Color_ThemeColor forState:0];
    self.closeBtn.titleLabel.font = BoldFontOfSize(16);
    [self.closeBtn addTarget:self action:@selector(disMissView) forControlEvents:UIControlEventTouchUpInside];
    [self.bgView addSubview:self.closeBtn];
    
    self.lineLab = [[UILabel alloc] initWithFrame:CGRectMake(0, self.closeBtn.nim_top - 1, self.bgView.nim_width, 1)];
    self.lineLab.backgroundColor = HexColor(0xF2F2F5);
    [self.bgView addSubview:self.lineLab];
    
    self.title1Lab = [[UILabel alloc] initWithFrame:CGRectMake(20, 35, self.bgView.nim_width - 40, 17)];
    self.title1Lab.text = @"包含类型";
    self.title1Lab.textColor = HexColor(0x9C9DB3);
    self.title1Lab.font = BoldFontOfSize(16);
    [self.bgView addSubview:self.title1Lab];
    
    self.content1Lab = [[UILabel alloc] initWithFrame:CGRectMake(20, 5 + self.title1Lab.nim_bottom, self.bgView.nim_width - 40, 17)];
    self.content1Lab.textColor = HexColor(0x2B2C44);
    self.content1Lab.font = BoldFontOfSize(16);
    [self.bgView addSubview:self.content1Lab];
    
    self.title2Lab = [[UILabel alloc] initWithFrame:CGRectMake(20, self.content1Lab.nim_bottom + (self.lineLab.nim_top - self.content1Lab.nim_bottom - 17 * 2 - 10) * 0.5, [FactoryMethod sizeWithText:@"已选件数：" font:BoldFontOfSize(16) maxSize:CGSizeMake(0, 0)].width, 17)];
    self.title2Lab.text = @"已选件数：";
    self.title2Lab.textColor = HexColor(0x9C9DB3);
    self.title2Lab.font = BoldFontOfSize(16);
    [self.bgView addSubview:self.title2Lab];
    
    self.content2Lab = [[UILabel alloc] initWithFrame:CGRectMake(self.title2Lab.nim_right, self.title2Lab.nim_top, self.bgView.nim_width * 0.5 - self.title2Lab.nim_right, 17)];
    self.content2Lab.textColor = HexColor(0x2B2C44);
    self.content2Lab.font = BoldFontOfSize(16);
    [self.bgView addSubview:self.content2Lab];
    
    self.title3Lab = [[UILabel alloc] initWithFrame:CGRectMake(self.bgView.nim_width * 0.5, self.title2Lab.nim_top, [FactoryMethod sizeWithText:@"已选数量：" font:BoldFontOfSize(16) maxSize:CGSizeMake(0, 0)].width, 17)];
    self.title3Lab.text = @"已选数量：";
    self.title3Lab.textColor = HexColor(0x9C9DB3);
    self.title3Lab.font = BoldFontOfSize(16);
    [self.bgView addSubview:self.title3Lab];
    
    self.content3Lab = [[UILabel alloc] initWithFrame:CGRectMake(self.title3Lab.nim_right, self.title3Lab.nim_top, self.bgView.nim_width - 20 - self.title3Lab.nim_right, 17)];
    self.content3Lab.textColor = HexColor(0x2B2C44);
    self.content3Lab.font = BoldFontOfSize(16);
    [self.bgView addSubview:self.content3Lab];
    
    self.title4Lab = [[UILabel alloc] initWithFrame:CGRectMake(20, self.title2Lab.nim_bottom + 10, [FactoryMethod sizeWithText:@"货物重量：" font:BoldFontOfSize(16) maxSize:CGSizeMake(0, 0)].width, 17)];
    self.title4Lab.text = @"货物重量：";
    self.title4Lab.textColor = HexColor(0x9C9DB3);
    self.title4Lab.font = BoldFontOfSize(16);
    [self.bgView addSubview:self.title4Lab];
    
    self.content4Lab = [[UILabel alloc] initWithFrame:CGRectMake(self.title4Lab.nim_right, self.title4Lab.nim_top, self.bgView.nim_width * 0.5 - self.title4Lab.nim_right, 17)];
    self.content4Lab.textColor = HexColor(0x2B2C44);
    self.content4Lab.font = BoldFontOfSize(16);
    [self.bgView addSubview:self.content4Lab];
    
    self.title5Lab = [[UILabel alloc] initWithFrame:CGRectMake(self.bgView.nim_width * 0.5, self.title4Lab.nim_top, [FactoryMethod sizeWithText:@"货物体积：" font:BoldFontOfSize(16) maxSize:CGSizeMake(0, 0)].width, 17)];
    self.title5Lab.text = @"货物体积：";
    self.title5Lab.textColor = HexColor(0x9C9DB3);
    self.title5Lab.font = BoldFontOfSize(16);
    [self.bgView addSubview:self.title5Lab];
    
    self.content5Lab = [[UILabel alloc] initWithFrame:CGRectMake(self.title5Lab.nim_right, self.title5Lab.nim_top, self.bgView.nim_width - 20 - self.title5Lab.nim_right, 17)];
    self.content5Lab.textColor = HexColor(0x2B2C44);
    self.content5Lab.font = BoldFontOfSize(16);
    [self.bgView addSubview:self.content5Lab];
}

-(void)setType:(NSString *)type {
    _type = type;
    self.content1Lab.text = type;
}

-(void)setJnum:(NSString *)jnum {
    _jnum = jnum;
    self.content2Lab.text = jnum;
}

-(void)setNum:(NSString *)num {
    _num = num;
    self.content3Lab.text = num;
}

-(void)setWeight:(NSString *)weight {
    _weight = weight;
    self.content4Lab.text = weight;
}

-(void)setVolume:(NSString *)volume {
    _volume = volume;
    self.content5Lab.text = volume;
}

- (void)showInView:(UIView *)view {
    if (!view) {
        return;
    }
    [view addSubview:self];
}

- (void)disMissView {
    [self removeFromSuperview];
}

@end
